import pytest

from Pages.page_log import PageLogin
from config import PATH
from script import log
from tool import read_json


class TestLogin:
    arg_nums = "phone,password,expect,img"
    @pytest.mark.smoke
    @pytest.mark.parametrize(arg_nums, read_json("login.json"))
    @pytest.mark.flaky(reruns=2, reruns_delay=1)
    def test_login_all(self, get_driver,phone, password, expect, img):
        self.login = PageLogin(get_driver)
        self.login.login(phone, password)
        result = self.login.assert_toast()
        log.info(f"执行结果是：{result}")
        self.login.base_get_img(img)
        print(result)
        assert expect in result
